<?php
define('ITEMS',10);
define('COLS',3);
$rows = ceil(ITEMS / COLS );
?>
<table border="1" cellspacing="5" cellpadding="10" width="70%" align="center">
  <tbody>
<?php
for ($i = 1,$count=1; $i <= $rows ; $i++)
{
  $color = $i%2==0 ? "yellow":"lightyellow";
?>
    <tr>
<?php
for ($k = 1; $k <= COLS ; $k++)
{
  if($count <= ITEMS) {
?>
      <td style="background-color:<?=$color?>">Text <?=$count++?></td>
<?php
  } else {//end if
    echo "<td>&nbsp;</td>";
  } // end else
}// end for k
?>
    </tr>
<?php
}// end for
?>
  </tbody>
</table>
